<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/9/30
 * Time: 17:08
 */

namespace app\common\validate;


class GoodsValidate extends BaseValidate
{
    protected $rule = [
        'name' => 'require',
        'price' => 'require|isFloatOrPositiveInteger',
        'category_id' => 'isPositiveInteger',
        'brand_id' => 'isPositiveInteger',
        'inventory' => 'isPositiveIntegerOrZero',
        'recommend' => 'require|in:0,1',
        'video' => 'require',
    ];
    protected $message = [
        'name.require' => '请输入商品名称',
        'price.require' => '请输入价格',
        'price.isFloatOrPositiveInteger' => '价格必须是大于0的数字',
        'category_id.isPositiveInteger' => '请选择分类',
        'brand_id.isPositiveInteger' => '请选择品牌',
        'inventory.isPositiveIntegerOrZero' => '请输入库存',
        'recommend.require' => '请选择是否推荐',
        'recommend.in' => '推荐参数错误',
        'video.require' => '请输入视频地址',
    ];
}